 // pages/refunddetails/index.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    content:'',
    time:'',
    set:''
  },

  //转时间
  uctime:function(){
    let that = this;
    var time = that.data.time;
    console.log(that.data.time)
    let t;
    if (time > -1) {
      var day = Math.floor(time / 3600 / 24);     //天
      //console.log(day,'------------')
      var hour = Math.floor(time / 3600) % 24;       //时
      //console.log(hour,'hourhour')
      var min = Math.floor(time / 60) % 60;     //分
      var sec = time % 60;                      //秒
      t = day + '天'
      if (hour < 10) {
        t += '0' + hour + "时";
      } else {
        t += hour + "时";
      }
      if (min < 10) { t += "0"; }
      t += min + "分";
      console.log(t, 'ttttttttt')
      // if (sec < 10) { t += "0"; }
      // t += sec.toFixed(2);
      that.setData({
        time: time - 1,
        times: t
      })
    }
   
    // set = setInterval(function(){
    //   let t;
    //   time = time-1
    //   if (time > -1) {
    //     var day = Math.floor(time / 3600 / 24);     //天
    //     //console.log(day,'------------')
    //     var hour = Math.floor(time / 3600) % 24;       //时
    //     //console.log(hour,'hourhour')
    //     var min = Math.floor(time / 60) % 60;     //分
    //     var sec = time % 60;                      //秒
    //     t = day + '天'
    //     if (hour < 10) {
    //       t += '0' + hour + "时";
    //     } else {
    //       t += hour + "时";
    //     }
    //     if (min < 10) { t += "0"; }
    //     t += min + "分";
    //     console.log(t, 'ttttttttt')
    //     // if (sec < 10) { t += "0"; }
    //     // t += sec.toFixed(2);
    //   }
    //   console.log(t,'t')
    //   that.setData({
    //     time: t
    //   })
    // },1000)
    
    
    //console.log(t)
  },

  //*/
  onform:function(){
    wx.navigateTo({
      url: '../refund_form/index'
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    let that = this;
    //https://zhapp.4hl.cn/app/order/refund_details?uid=1437&orderid=307
    wx.request({
      url: 'https://zhapp.4hl.cn/app/order/refund_details',
      data: {
        uid: wx.getStorageSync('userInfo').uid,
        orderid: options.id
      },
      method: 'get',
      success: function (res) {
        that.setData({
          content: res.data.data[0],
          time: res.data.data[0].time ? res.data.data[0].time:''
        })
        that.uctime()
        that.setData({
          
          // set: setInterval(function(){
            
          // }, 1000)
        })
        
      }
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  
  onReady: function () {
  
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {
    //clearInterval(this.uctime())
    //clearInterval(this.data.set)
    
  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {
    //clearInterval(this.uctime())
    //clearInterval(this.data.set)
  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
  
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
  
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
  
  }
})